<?php

/**
 * Performances form base class.
 *
 * @method Performances getObject() Returns the current form's model object
 *
 * @package    gamerstats
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePerformancesForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idperformances' => new sfWidgetFormInputHidden(),
      'user'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => false)),
      'round'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Rounds'), 'add_empty' => false)),
      'stat1'          => new sfWidgetFormInputText(),
      'stat2'          => new sfWidgetFormInputText(),
      'stat3'          => new sfWidgetFormInputText(),
      'stat4'          => new sfWidgetFormInputText(),
      'stat5'          => new sfWidgetFormInputText(),
      'stat6'          => new sfWidgetFormInputText(),
      'stat7'          => new sfWidgetFormInputText(),
      'stat8'          => new sfWidgetFormInputText(),
      'stat9'          => new sfWidgetFormInputText(),
      'stat10'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'idperformances' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idperformances')), 'empty_value' => $this->getObject()->get('idperformances'), 'required' => false)),
      'user'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Users'))),
      'round'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Rounds'))),
      'stat1'          => new sfValidatorNumber(),
      'stat2'          => new sfValidatorNumber(array('required' => false)),
      'stat3'          => new sfValidatorNumber(array('required' => false)),
      'stat4'          => new sfValidatorNumber(array('required' => false)),
      'stat5'          => new sfValidatorNumber(array('required' => false)),
      'stat6'          => new sfValidatorNumber(array('required' => false)),
      'stat7'          => new sfValidatorNumber(array('required' => false)),
      'stat8'          => new sfValidatorNumber(array('required' => false)),
      'stat9'          => new sfValidatorNumber(array('required' => false)),
      'stat10'         => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('performances[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Performances';
  }

}
